package com.itheima.mapper;

import com.itheima.pojo.Emp;
import com.itheima.pojo.EmpExpr;
import com.itheima.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.*;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {

    // @Select("select emp.* , dept.name as deptName from emp left join dept on emp.dept_id = dept.id")
    List<Emp> findAll(EmpQueryParam empQueryRaram);


    /**
     * 新增员工数据
     */
    /**
     * 新增员工数据
     */
    /*@Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into emp(username, name, gender, phone, job, salary, image, entry_date, dept_id, create_time, update_time) " +
            "values (#{username},#{name},#{gender},#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")*/
    void insertEmp(Emp emp);
    /**
     * 批量删除员工信息
     */
    void deleteByIds(@Param("ids")List<Integer> ids);
    /**
     * 根据ID查询员工详细信息
     */
    @Select("select * from emp where id =#{id}")
    Emp getById(Integer id);
    /**
     * 更新员工基本信息
     */
    void updateById(Emp emp);
    /**
     * 统计各个职位的员工人数
     */
    @MapKey("pos")
    List<Map<String,Object>> countEmpJobData();
    /**
     * 统计员工性别信息
     */
    @MapKey("name")
    List<Map> countEmpGenderData();


        // 根据用户名和密码查询员工
       // @Select("select * from emp where username = #{username} and password = #{password}")
        Emp getByUsernameAndPassword(Emp emp);

        @Select("select * from emp")
         List<Emp> listAll();
}


